<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:p="http://primefaces.prime.com.tr/ui">

<ui:composition>


	<h:form prependId="false">

		<p:growl id="messages" showDetail="true" />
				
				<p:dataTable var="items" value="#{mEnquiry.allEnquiry}" paginator="true" rows="10"
		 		 			 paginatorAlwaysVisible="false" id="enquiry_table"
							 dynamic="true">
							 
					 <p:column>
						<f:facet name="header"></f:facet>
						<p:rowToggler />
					 </p:column>
 		 			 
 		 			 <p:column sortBy="#{items.customerName}" filterBy="#{items.customerName}"
 		 			 		filterMatchMode="contains">	
 		 			 	<f:facet name="header">
 		 			 		<h:outputText value="Name" />
 		 			 	</f:facet>
 		 			 	<h:outputText value="#{items.customerName}" />
 		 			 </p:column>
 		 			 
 		 			 <p:column sortBy="#{items.email}" filterBy="#{items.email}"
 		 			 		filterMatchMode="contains">
 		 			 	<f:facet name="header">
 		 			 		<h:outputText value="Email" />
 		 			 	</f:facet>
 		 			 	<h:outputText value="#{items.email}" />
 		 			 </p:column>
 		 			 
 		 			 <p:column sortBy="#{items.creationDate}">
 		 			 	<f:facet name="header">
 		 			 		<h:outputText value="Creation Date" />
 		 			 	</f:facet>
 		 			 	<h:outputText value="#{items.creationDate}" />	
 		 			 </p:column>
 		 			 
 		 			 <p:column>
 		 			 	<f:facet name="header">
 		 			 		<h:outputText value="Delete" />
 		 			 	</f:facet>
 		 			 	<a4j:commandLink styleClass="no-decor" execute="@this"
							render="@none" oncomplete="confirmation.show()">
							<h:graphicImage value="/resources/images/delete.gif" alt="delete" />
							<a4j:param value="#{items.enquiryID}" assignTo="#{mEnquiry.currentEnq}" />
							<f:setPropertyActionListener value="#{items}" target="#{mEnquiry.enq}" />
						</a4j:commandLink>
 		 			 </p:column>
 		 			 
 		 			 <p:rowExpansion>
						<div class="box3">
							<div class="prop_info">
								<ul class="list1">
									<li><strong>Customer Name: </strong> <h:outputText
											value="#{items.customerName}" /></li>
									<li><strong>Email: </strong> <h:outputText
											value="#{items.email}" /></li>
									<li><strong>Phone: </strong> <h:outputText
											value="#{items.phone}" /></li>
									<li><strong>Creation Date: </strong> <h:outputText
											value="#{items.creationDate}" /></li>
									<li><strong>Subject: </strong> <h:outputText
											value="#{items.subject}" /></li>
									<li><strong>Message: </strong> <h:outputText
											value="#{items.message}" /></li>
								</ul>
							</div>
						</div>
					</p:rowExpansion>
				</p:dataTable>
				
				<p:confirmDialog message="Are you sure about deleting this enquiry"
							showEffect="bource" hideEffect="explode"
							header="Deleting process" severity="alert" widgetVar="confirmation">
					
					<p:commandButton value="Yes Sure" update="enquiry_table, messages" oncomplete="confirmation.hide()" 
								action="#{mEnquiry.remove}" />
					<p:commandButton value="Not Yet" onclick="confirmation.hide()" type="button" />
				</p:confirmDialog>

	</h:form>
</ui:composition>
</html>